package com.fisherman.config;

import com.fisherman.bean.Person;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * @User: fisherman
 * @Date: 2020/5/21 10:35
 */
//使用@PropertySource读取外部配置文件中的k/v保存到运行的环境变量中;
    //加载完外部配置文件以后使用${}取出配置文件的值
@PropertySource(value = {"classpath:/person.properties"})
@Configuration   //告诉spring这个是一个配置类
public class MainConfigOfPropertyValue {

    //添加一个组件 Person
    @Bean
    public Person person() {
        return new Person();
    }
}
